package com.linhh.mall.center.web.listener;

import com.linhh.mall.center.api.GoodsInfoService;
import com.linhh.mall.center.common.constant.ConstantKey;
import com.linhh.mall.center.common.pojo.GoodsInfo;
import org.apache.dubbo.config.annotation.Reference;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * 消费者消息商品信息
 * @Author linhh
 * @Date 2023 02 21 02 22
 **/
@RocketMQMessageListener(
        topic = ConstantKey.TOPIC_NAME,
        consumerGroup = "my-consumer-group",
        selectorExpression = "*"
)
@Component
public class GoodsMQListener implements RocketMQListener<GoodsInfo> {

    @Reference
    private GoodsInfoService goodsInfoService;

    @Override
    public void onMessage(GoodsInfo message) {

        String result = goodsInfoService.staticPageBuild(message);
        System.out.println(result+" :"+message);
    }
}
